Skip to content

Example 1 First Request and Response

Fernando Koch edited this page Mar 30, 2026 · 3 revisions

Example 1: First Request And Response

Goal

Understand the smallest useful public GraphK flow.

Scenario

You have one incoming value and you want one response. You do not need branching, policy, or a complex architecture yet. You only want to see the session enter the graph and the response come back out.

Example

import graphk


pipeline = graphk.SequencePipe(nodes=[graphk.demo.EchoNode()])
program = graphk.Program({"echo": pipeline})
emitter = graphk.Emitter(program)

emitter.request("echo", graphk.Session(value=5))

print(emitter.response())

What Happens?

  • the program stores the pipeline under echo
  • the emitter resolves echo
  • a transient runner executes the pipeline
  • EchoNode reads value
  • EchoNode writes a response payload
  • emitter.response() returns that payload from the cached session

Why This Example Matters

This is the simplest complete GraphK story:

  • architecture
  • program registration
  • runtime state
  • execution
  • final response

Run The Full Example

Clone this wiki locally