Documentation
¶
Overview ¶
Package agentcoretesting provides package-local conformance helpers for validating public agentcore implementations against the expected contracts.
The helpers in this package are intended for external implementers of agentcore.Provider, agentcore.Storage, and agentcore.ToolRegistry. They are deliberately small and only rely on the public agentcore contracts so they can be reused outside this repository.
Beyond runnable suites such as RunStorageSuite, RunToolRegistrySuite, and RunProviderSuite, the package also exposes lightweight navigation metadata:
- ContractChecklist reports the current contract/evidence matrix
- OnboardingChecklist reports recommended docs, suites, and examples for common external implementer roles
Index ¶
- func RunProviderSuite(t *stdtesting.T, factory ProviderFactory)
- func RunStorageFixtureSuite(t *stdtesting.T, factory StorageCaseFactory)
- func RunStorageSuite(t *stdtesting.T, factory StorageFactory)
- func RunToolRegistrySuite(t *stdtesting.T, factory ToolRegistryFactory)
- type ChecklistItem
- type ContractStatus
- type EvidenceLevel
- type GenerateCase
- type OnboardingItem
- type ProviderFactory
- type ProviderFixture
- func (f ProviderFixture) WithGenerateError(name string, req *agentcore.GenerateRequest, wantErr error) ProviderFixture
- func (f ProviderFixture) WithStreaming(tc StreamingCase) ProviderFixture
- func (f ProviderFixture) WithStreamingError(tc StreamingCase) ProviderFixture
- func (f ProviderFixture) WithStreamingHandlerError(tc StreamingCase) ProviderFixture
- func (f ProviderFixture) WithStreamingProvider(provider agentcore.StreamingProvider) ProviderFixture
- type StorageCaseFactory
- type StorageFactory
- type StorageFixture
- func (f StorageFixture) WithAppendMessagesError(err error) StorageFixture
- func (f StorageFixture) WithLoadMessagesError(err error) StorageFixture
- func (f StorageFixture) WithLoadRunError(err error) StorageFixture
- func (f StorageFixture) WithSaveRunError(err error) StorageFixture
- func (f StorageFixture) WithSaveRunMissingIDError(err error) StorageFixture
- type StoragePathFactory
- type StreamingCase
- type ToolExecuteCase
- type ToolRegistryFactory
- type ToolRegistryFixture
- func (f ToolRegistryFixture) WithExecuteCase(tc ToolExecuteCase) ToolRegistryFixture
- func (f ToolRegistryFixture) WithExecuteError(name string, call agentcore.ToolCall, wantErr error) ToolRegistryFixture
- func (f ToolRegistryFixture) WithExpectedSchema(schema agentcore.ToolSchema) ToolRegistryFixture
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunProviderSuite ¶
func RunProviderSuite(t *stdtesting.T, factory ProviderFactory)
RunProviderSuite runs the minimal public provider conformance checks.
func RunStorageFixtureSuite ¶
func RunStorageFixtureSuite(t *stdtesting.T, factory StorageCaseFactory)
RunStorageFixtureSuite runs the storage conformance checks against one fixture.
func RunStorageSuite ¶
func RunStorageSuite(t *stdtesting.T, factory StorageFactory)
RunStorageSuite runs the minimal public storage conformance checks.
func RunToolRegistrySuite ¶
func RunToolRegistrySuite(t *stdtesting.T, factory ToolRegistryFactory)
RunToolRegistrySuite runs the minimal public tool registry conformance checks.
Types ¶
type ChecklistItem ¶
type ChecklistItem struct {
Surface string
Status ContractStatus
Evidence EvidenceLevel
RecommendedSuites []string
Notes string
}
ChecklistItem summarizes one contract surface together with the recommended verification entry points currently available in agentcore/testing.
func ContractChecklist ¶
func ContractChecklist() []ChecklistItem
ContractChecklist returns the current package-local contract matrix in a machine-readable form so docs and tooling can point at the same source of truth.
type ContractStatus ¶
type ContractStatus string
ContractStatus describes the current stability posture of one public surface.
const ( StatusHighConfidence ContractStatus = "High confidence in v0" StatusStableDirection ContractStatus = "Stable direction, careful evolution" StatusMustStayConservative ContractStatus = "Must stay conservative" StatusShouldKeepTightening ContractStatus = "Should keep tightening" StatusUsefulButEvolving ContractStatus = "Useful but still evolving" StatusNeededForPosture ContractStatus = "Needed for independent package posture" StatusHostReadyCandidate ContractStatus = "Kernel-stable candidate" StatusImportantRelease ContractStatus = "Important release surface" )
type EvidenceLevel ¶
type EvidenceLevel string
EvidenceLevel describes what kind of verification currently supports a surface.
const ( EvidenceRuntime EvidenceLevel = "Runtime" EvidenceRuntimeHost EvidenceLevel = "Runtime + Host" EvidenceDefaultPath EvidenceLevel = "Default Path" )
type GenerateCase ¶
type GenerateCase struct {
Name string
Request *agentcore.GenerateRequest
WantResult *agentcore.GenerateResult
WantErr error
}
GenerateCase describes one expected Generate call against a provider.
func NewGenerateCase ¶
func NewGenerateCase(name string, req *agentcore.GenerateRequest, want *agentcore.GenerateResult) GenerateCase
NewGenerateCase creates a named provider generate contract case.
type OnboardingItem ¶
type OnboardingItem struct {
Kind string
RecommendedSuites []string
Docs []string
Examples []string
Notes string
}
OnboardingItem describes the recommended starting points for one external implementation category.
func OnboardingChecklist ¶
func OnboardingChecklist() []OnboardingItem
OnboardingChecklist returns a small package-local navigation guide for external implementers who want to validate a custom agentcore integration.
type ProviderFactory ¶
type ProviderFactory func(t *stdtesting.T) ProviderFixture
ProviderFactory returns a fresh provider fixture for one test case.
type ProviderFixture ¶
type ProviderFixture struct {
Provider agentcore.Provider
StreamProvider agentcore.StreamingProvider
GenerateCases []GenerateCase
Streaming *StreamingCase
StreamingCases []StreamingCase
}
ProviderFixture configures provider conformance checks.
func NewProviderFixture ¶
func NewProviderFixture(provider agentcore.Provider, cases ...GenerateCase) ProviderFixture
NewProviderFixture creates a minimal provider conformance fixture.
func (ProviderFixture) WithGenerateError ¶
func (f ProviderFixture) WithGenerateError(name string, req *agentcore.GenerateRequest, wantErr error) ProviderFixture
WithGenerateError appends one expected provider error case.
func (ProviderFixture) WithStreaming ¶
func (f ProviderFixture) WithStreaming(tc StreamingCase) ProviderFixture
WithStreaming returns a copy of the fixture with one streaming case attached.
func (ProviderFixture) WithStreamingError ¶
func (f ProviderFixture) WithStreamingError(tc StreamingCase) ProviderFixture
WithStreamingError appends one expected streaming provider error case.
func (ProviderFixture) WithStreamingHandlerError ¶
func (f ProviderFixture) WithStreamingHandlerError(tc StreamingCase) ProviderFixture
WithStreamingHandlerError appends one expected stream-handler failure case.
func (ProviderFixture) WithStreamingProvider ¶
func (f ProviderFixture) WithStreamingProvider(provider agentcore.StreamingProvider) ProviderFixture
WithStreamingProvider attaches a dedicated streaming-capable provider for stream cases.
type StorageCaseFactory ¶
type StorageCaseFactory func(t *stdtesting.T) StorageFixture
StorageCaseFactory returns a fresh storage-conformance fixture for one test case.
type StorageFactory ¶
type StorageFactory func(t *stdtesting.T) agentcore.Storage
StorageFactory creates an isolated storage implementation for one test case.
func NewStorageFactoryFromPath ¶
func NewStorageFactoryFromPath(factory StoragePathFactory) StorageFactory
NewStorageFactoryFromPath adapts a path-based storage constructor into a StorageFactory backed by t.TempDir().
type StorageFixture ¶
type StorageFixture struct {
Storage agentcore.Storage
RoundTripStorage agentcore.Storage
MessagesStorage agentcore.Storage
ResumeStorage agentcore.Storage
SaveRunErr error
LoadRunErr error
AppendMessagesErr error
LoadMessagesErr error
SaveRunMissingIDErr error
}
StorageFixture configures storage conformance checks.
func NewStorageFixture ¶
func NewStorageFixture(storage agentcore.Storage) StorageFixture
NewStorageFixture creates a minimal storage conformance fixture.
func (StorageFixture) WithAppendMessagesError ¶
func (f StorageFixture) WithAppendMessagesError(err error) StorageFixture
WithAppendMessagesError appends one expected AppendMessages failure case.
func (StorageFixture) WithLoadMessagesError ¶
func (f StorageFixture) WithLoadMessagesError(err error) StorageFixture
WithLoadMessagesError appends one expected LoadMessages failure case.
func (StorageFixture) WithLoadRunError ¶
func (f StorageFixture) WithLoadRunError(err error) StorageFixture
WithLoadRunError appends one expected LoadRun failure case.
func (StorageFixture) WithSaveRunError ¶
func (f StorageFixture) WithSaveRunError(err error) StorageFixture
WithSaveRunError appends one expected SaveRun failure case.
func (StorageFixture) WithSaveRunMissingIDError ¶
func (f StorageFixture) WithSaveRunMissingIDError(err error) StorageFixture
WithSaveRunMissingIDError appends one expected SaveRun invalid-input case.
type StoragePathFactory ¶
type StoragePathFactory func(t *stdtesting.T, root string) agentcore.Storage
StoragePathFactory creates a storage rooted at an isolated directory path.
type StreamingCase ¶
type StreamingCase struct {
Name string
Request *agentcore.GenerateRequest
WantEvents []agentcore.StreamEvent
WantResult *agentcore.GenerateResult
WantErr error
EmitErr error
}
StreamingCase describes one optional streaming provider scenario.
type ToolExecuteCase ¶
type ToolExecuteCase struct {
Name string
Call agentcore.ToolCall
WantResult *agentcore.ToolResult
WantErr error
}
ToolExecuteCase describes one expected ExecuteTool call against a registry.
func NewToolExecuteCase ¶
func NewToolExecuteCase(name string, call agentcore.ToolCall, want *agentcore.ToolResult) ToolExecuteCase
NewToolExecuteCase creates a named tool execution case.
type ToolRegistryFactory ¶
type ToolRegistryFactory func(t *stdtesting.T) ToolRegistryFixture
ToolRegistryFactory returns a preconfigured registry fixture for one test case.
type ToolRegistryFixture ¶
type ToolRegistryFixture struct {
Registry agentcore.ToolRegistry
ExpectedSchema agentcore.ToolSchema
ExpectedSchemas []agentcore.ToolSchema
ExecuteCall agentcore.ToolCall
WantResult *agentcore.ToolResult
WantErr error
ExecuteCases []ToolExecuteCase
}
ToolRegistryFixture configures a tool registry conformance scenario.
func NewToolRegistryFixture ¶
func NewToolRegistryFixture( registry agentcore.ToolRegistry, schema agentcore.ToolSchema, call agentcore.ToolCall, want *agentcore.ToolResult, ) ToolRegistryFixture
NewToolRegistryFixture creates a minimal tool-registry conformance fixture.
func (ToolRegistryFixture) WithExecuteCase ¶
func (f ToolRegistryFixture) WithExecuteCase(tc ToolExecuteCase) ToolRegistryFixture
WithExecuteCase appends one additional execute success case.
func (ToolRegistryFixture) WithExecuteError ¶
func (f ToolRegistryFixture) WithExecuteError(name string, call agentcore.ToolCall, wantErr error) ToolRegistryFixture
WithExecuteError appends one expected execute error case.
func (ToolRegistryFixture) WithExpectedSchema ¶
func (f ToolRegistryFixture) WithExpectedSchema(schema agentcore.ToolSchema) ToolRegistryFixture
WithExpectedSchema appends one additional listed-schema expectation.