Browse documentation
Python API
View Markdown
On this page

Python API

The reference for everything you can import from gvn. It is generated from the source, so each name appears with its import line, signature and docstring.

How the packages fit together

gvn is built in layers. Each package imports only from the ones below it, so you can use an inner layer without the outer ones: the kernel alone gives you verified state machines, the harness adds agents and workflows, the runtime runs them, and the adapters connect them to real vendors and databases.

flowchart TB
    shortcuts["gvn.shortcuts<br/>one call runs an agent"] --> adapters
    console["gvn.console<br/>the gvn command line"] --> adapters
    adapters["gvn.adapters<br/>vendors and databases"] --> evals
    evals["gvn.evals<br/>measuring a harness"] --> runtime
    runtime["gvn.runtime<br/>the Governor, journal, recovery"] --> harness
    harness["gvn.harness<br/>agents, workflows, tools, ports"] --> kernel
    kernel["gvn.kernel<br/>verified state machines"]
    testing["gvn.testing<br/>fakes and contract suites, for tests"]
Package What it is
gvn.shortcuts The short path: one agent, some tools and a model, run to the end in one call. Start here, and move to the packages below when you need to pause, recover or compose.
gvn.kernel State machines and their verifier: blueprints you declare, definitions that are proven complete, the machines built from them, decisions, schemas and diagrams. It is the innermost layer and imports nothing else in gvn.
gvn.harness Actors and what they are made of: agents, workflows, tools, messages, events and requests, plus the ports, which are the interfaces the outside world implements. It builds on the kernel and does no I/O.
gvn.runtime The Governor and everything around a run: fulfilling requests, journaling, recovery, replay, forks, leases, memory, spending and throttles. It drives the actors the harness defines.
gvn.adapters Implementations of the ports for real vendors and backends: model clients, SQLite and PostgreSQL journals, logs, traces and eval files. One module per vendor or backend.
gvn.evals Measuring how well a version of a harness does its job: cases, criteria, judges, trials, reports and comparisons.
gvn.console The gvn command line and the Project it loads: what one codebase offers to gvn's tools.
gvn.testing The public test kit: an in-memory fake for every port, and the contract suites every implementation of a port must pass. Import it from tests only.

Find it by what you want to do

You want to Look at In
Run one agent to the end in one call run_agent, FunctionTool gvn.shortcuts
Declare a state machine and have it verified MooreBlueprint, MealyBlueprint, Machine gvn.kernel
Branch on data without losing completeness Decision gvn.kernel
Describe the shape of a payload Record, Text, OneOf gvn.kernel
Build an agent with tools Agent, Toolbox, Tool gvn.harness
Compose actors into a workflow Workflow, Plan, Host gvn.harness
Ask a person and wait for the answer Approval, Inquiry, Authenticated gvn.harness
Drive a run, pause it and answer it Governor, Result gvn.runtime
Bring a run back after a restart Recovery, Replay, Fork gvn.runtime
Limit spending and call rates Allowance, RateThrottle gvn.runtime
Connect a vendor model or a database AnthropicModel, OpenAIModel, SqliteJournal, PostgresJournal gvn.adapters
Measure a harness and compare versions Eval, Runner, Report, Comparison gvn.evals
Test offline, with no model and no clock ScriptedModel, MemoryJournal, ManualClock gvn.testing

The interface contracts say what your own tools, actors and adapters must honour when you extend gvn.

Every name, A to Z

All 364 public classes and functions. Each links to its entry on the package's page.

A abandoned · Abandoned · Actor · add_case · After · Agent · AgentRun · Agreement · AllOf · Allowance · Alphabet · Answer · answer_for · answer_format (anthropic, adapters) · answer_format (chat_completions, adapters) · answer_format (openai, adapters) · answer_from_plain · answer_plain · answer_reply · AnsweredBy · Answering · answering · AnthropicModel · AnyOf · Approval · approval_payload · ApprovedFirst · Approving · Ask · AskBeforeEveryCall · asked · assistant_reply · At · AtLeast · Attachment · attempt · Authenticated · Avoids

B blocked_note · Boolean · Branch · Budget · BudgetExhausted · Busy · By

C calls_payload · calls_to · Case · case_fields · Change · ChatCompletionsModel · Check · Checked · Choice · Chosen · ClearToolResults · Clock · ClockContract · ClockFulfiller · Closing · code_identity · Comparison · Compensate · ConcurrencyThrottle · Consultation · context_budget · ContextBudget · ContextCheck · ContextGauge · Conversation · cosine_similarity · Crash · CrashingJournal · Criteria · Criterion · CriterionEntry

D Dataset · Decision · Definition · DefinitionMismatch · DefinitionRejected · denials · denied_detail · Difference (Difference, evals) · Difference (Difference, kernel) · DockerUnavailable · Dot · Driven · Dto · DtoOf · Durable

E Either · embedded · Embedder · EmbedderContract · EmbedderFailure · Ending · Entry · Environment · EnvironmentHolds · Environments · Errand · error_text · Eval · EvalFile · Evaluation · Event · Evidence · Exchange · exposed_by · exposure_checked · exposure_revived · exposure_stored

F FailureCheck · FallbackModel · FanOut · Fanout · FileProblem · Finding · Finishes · FixedCall · FixedEnvironments · FixedSubject · ForEach · Fork · Forms · Frame · Fulfiller · FunctionModel · FunctionTool · fused_ranking

G Gated · Governor · Grade

H Harness · HashingEmbedder · HeldModel · Host

I identified_calls · identities_held · identity_checked · Incomparable · Inquiry · Inspection · Inspector · Integer · Interval · Invocation · invoke_payload · is_call_to · is_recalled_note · is_sensor_note

J Join · Journal · JournalContract · Json · JsonFormatter · Judge · judged · Judgement · junit

K KeepRecent · kept_text

L Launcher · Lease · Leaseholder · LeaseLost · Leases · LeasesContract · ListMemory · ListOf · load_project · LoggingOutput

M Machine · main · Majority · ManifestMismatch · ManualClock · MapOf · MealyBlueprint · measuring_tool · Memo · Memory · MemoryContract · MemoryFailure · MemoryFulfiller · MemoryJournal · MemoryLeases · MemoryResults · MemoryScope · Mermaid · Message · Model · model_role_checked · ModelAsked · ModelContract · ModelFailure · ModelFulfiller · Moment · MooreBlueprint · Movement

N Named · namespace_checked · NewerForm · NewerSchema · NoRejections · NotEntitled · NotFinished · NotLive · NotOffered · NoUpgrade · Nullable · Number

O OneOf · OpenAIEmbedder · OpenAIModel · Outcome · Output · OutputContract · OverBudget

P Parallel · Parks · parse_answer · Plan · PlanRejected · PolicyFulfiller · PositionTaken · PostgresJournal · PostgresLeases · PostgresMemory · Principal · Progress · Project

Q qualified_tool_names · Quiet · Quorum

R ran_statuses · Rate · Rates · RateThrottle · Reaction · read_cases · read_eval · readings_note · recall_checked · recall_limit_checked · recalled_note · RecallTool · Record · record_from_json_schema · RecordingOutput · Recovery · Reduction · refusal_detail · refused · RememberTool · remove_case · replace_case · Replay · Reply · Report (Report, evals) · Report (Report, harness) · Report (Report, kernel) · Request · require_own_dto · Result (Result, harness) · Result (Result, runtime) · result_attachments · Results · ResultsContract · Retry (ports, harness) · Retry (workflow, harness) · retry_after (anthropic, adapters) · retry_after (openai, adapters) · returned · Review · route · run · run_agent · run_context · RunHeld · Runner

S Schema · SchemaNotPrepared · SchemaViolation · Score · Scorecard · ScriptedModel · ScriptedStandIn · ScriptExhausted · Sensed · Sensor · SensorCheck · SensorFulfiller · sensorless_actors · SensorReadings · SettingsMismatch · settled · short_name · shown · Signal · spec_from_plain · spec_plain · Spend · Spends · SqliteJournal · SqliteLeases · SqliteMemory · SqliteResults · stability · StandIn · Standing · standing · State · Step · StreamOutput · StubTool · Subject · Summarise · Symbol · SystemClock

T Table · Text · Throttle · ThrottleContract · ThrottledModel · Throttles · ThrowawayPostgres · Timer · Tool · tool_checked · tool_error · tool_results · TooLate · Toolbox · ToolCall · ToolContract · ToolFailure · ToolFulfiller · ToolOutput · ToolResult · tools_given · ToolSpec · Trace · TracingOutput · transcribed · Transcript

U Unanswered · UndeclaredOutcome · Unfulfillable · UnknownRun · UnknownSymbol · UnknownTool · Unpriced · untrusted_of

V Verdict · verdicts_revived · verdicts_stored · Verifier · Visits

W Within · Workflow · Worst · write_cases